<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script type="text/javascript" src="${ctx}/js/system/producttree/add.js"></script>
<div class="hk_business hk_b_add">
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/producttree/addEntity.shtml">
		<section class="panel panel-default restrict">
			<div class="panel-body">
			<input type="hidden" name="token" value="${token}"/>
				<div class="form-group">
					<label class="col-sm-3 control-label">产品名称：</label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入产品名称" name="producttreeFormMap.name" id="name" />
						<span style="color: red;">*</span>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">产品编号： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入产品编号" name="producttreeFormMap.code" id="code">
						<span style="color: red;">*</span>
					</div>
				</div>

				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">从属于： </label>
					<div class="col-sm-9">
						<select name="producttreeFormMap.parentId" id="producttreeName"
							class="form-control m-b">
						</select>
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">产品类型： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入产品编号" name="producttreeFormMap.type" id="type">
						<span style="color: red;">*</span>
					</div>
				</div>
				
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">价格(元)： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入价格（元）" name="producttreeFormMap.price" id="price">
					</div>
					<span style="color: red;">*</span>
				</div>

				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">单位： </label>
					<div class="col-sm-9">
						<select class="form-control" name="producttreeFormMap.unit"
							id="unit">
							<option value="人民币">人民币</option>
							<option value="美元">美元</option>
							<option value="港币">港币</option>
							<option value="欧元">欧元</option>
						</select>
					</div>
				</div>

				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">产品规格： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入产品规格" name="producttreeFormMap.specification"
							id="specification">
					</div>
					<span style="color: red;">*</span>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">备注： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc" placeholder=""
							name="producttreeFormMap.remarks" id="remarks">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">销售方式： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc"
							placeholder="请输入销售方式" name="producttreeFormMap.sell_way"
							id="sell_way">
					</div>
				</div>
				<div class="line line-dashed line-lg pull-in"></div>
				<div class="form-group">
					<label class="col-sm-3 control-label">详情： </label>
					<div class="col-sm-9">
						<input type="text" class="form-control checkacc" placeholder=""
							name="producttreeFormMap.description" id="description">
					</div>
				</div>
		</section>
		<footer class="panel-footer text-right bg-light lter">
			<button type="submit" class="btn btn-success btn-s-xs" >提交</button>
		</footer>
	</form>
</div>
<script>
	var floating = function(){
		   var _lue;
		   $(this).val($(this).val().replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g,''))
	    $(this).css("ime-mode","disabled");
		   var _price = $(this).val(),
		       _priceS = _price.split(".");
	   if(_priceS[0].length>15) {
	       _lue =  _priceS[0] = _priceS[0].substring(0,15);
	   }else{
	       _lue = _priceS[0];
	   }
	
	   if(_priceS[1]!==undefined){
	       if(_priceS[1].length>2) {
	           _priceS[1] = _priceS[1].substring(0,2);
	           _lue = _lue + '.' + _priceS[1];
	       }else{
	           _lue = _lue+'.'+_priceS[1];
	       }
	   }
	   var price = /^\d+\.?\d{0,2}$/.test($(this).val()) ? _lue :  _priceS[0] == '' ? '' : _priceS[0]+"."+_priceS[1];
	   $(this).val(price);
	}
	$("#price").on("keyup",floating);
</script>
<script>
function clickHandler(key){
	  // do something
	 key.disabled="disabled";
	}
</script>